async function registerInfo(username, password) {
  const res = await axios({
    url: '/register',
    method: 'post',
    data: {
      username,
      password
    }
  })
  pxmu.success(res.data.message)
  setTimeout(() => {
    location.href = 'login.html'
  }, 1500)
}


document.querySelector('.btn-inner--text').addEventListener('click', async e => {
  e.preventDefault()
  const form = document.querySelector('.register-form')
  const data = serialize(form, { hush: true, empty: true })
  const isRight = regUserInfo(data.username, data.password)
  if (isRight) {
    const username = data.username//shenqq160
    const password = data.password
    registerInfo(username, password)
  }
})